package com.guogee.db;

import java.net.UnknownHostException;

import com.guogee.util.BuildHelper;
import com.guogee.util.Constants;
import com.mongodb.DB;
import com.mongodb.Mongo;


public class DBHelper {
	private static DBHelper mInstance = new DBHelper();
	public static final String DB_NAME = "ismart";
	public static final String DB_NAME_PRO = "ismart2";
	private Mongo mongo;
	private DB ismartDB;

	private DBHelper() {
		try {
			mongo = new Mongo(Constants.Localhost, 27017);
			if(BuildHelper.isProduct()){
				ismartDB = mongo.getDB(DB_NAME_PRO);
			}else{
				ismartDB = mongo.getDB(DB_NAME);
			}
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
	}

	public static DBHelper getInstance() {
		return mInstance;
	}

	public Mongo getMongo() {
		return mongo;
	}

	public DB getIsmartDB() {
		return ismartDB;
	}
	
	public static class CommunityCollection{
		public static final String COLLECTION_NAME = "Community";
		public static final String ID = "_id"; 
		public static final String UUID = "uuid"; //小区id
		public static final String NAME = "name"; //小区名字
		public static final String COUNTRY = "country"; //国家
		public static final String PROVINCE = "province"; //省
		public static final String CITY = "city"; //市
		public static final String REGION = "region"; //区

	}
}
